//题目：求100之内的素数(1是不是素数?)
public class Test27 {
    public static void main(String[] args) {
        int i = 2;
        int j = 2;
        int k = 0;
        int flag = 0;
        System.out.print("素数：");
        for (i = 2; i < 100; i++) {
            if (i == 2) {
                k++;
                System.out.print(i + " ");
            } else {
                for (j = 2; j <= Math.sqrt(i); j++) {
                    if (i % j == 0) {
                        flag = 0;
                        break;
                    } else {
                        flag = 1;
                    }
                }
                if (flag == 1) {
                    k++;
                    System.out.print(i + " ");
                }
            }
        }
        System.out.print("\n");
        System.out.println("总数有" + k + "个。");
        System.out.println("1不是素数。");
    }
}
